import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 点检计划信息 */
export interface EquipmentCheckPlan {
          id: number; // id
          name?: string; // 计划名称
          repeat: number; // 点检频率
          equipmentTypeId: string; // 点检对象
          equipmentTypeName: string; // 点检对象名称
  }

// 点检计划 API
export const EquipmentCheckPlanApi = {
  // 查询点检计划分页
  getEquipmentCheckPlanPage: async (params: any) => {
    return await request.get({ url: `/business/equipment-check-plan/page`, params })
  },

  // 查询点检计划详情
  getEquipmentCheckPlan: async (id: number) => {
    return await request.get({ url: `/business/equipment-check-plan/get?id=` + id })
  },

  // 新增点检计划
  createEquipmentCheckPlan: async (data: EquipmentCheckPlan) => {
    return await request.post({ url: `/business/equipment-check-plan/create`, data })
  },

  // 修改点检计划
  updateEquipmentCheckPlan: async (data: EquipmentCheckPlan) => {
    return await request.put({ url: `/business/equipment-check-plan/update`, data })
  },

  // 删除点检计划
  deleteEquipmentCheckPlan: async (id: number) => {
    return await request.delete({ url: `/business/equipment-check-plan/delete?id=` + id })
  },

  /** 批量删除点检计划 */
  deleteEquipmentCheckPlanList: async (ids: number[]) => {
    return await request.delete({ url: `/business/equipment-check-plan/delete-list?ids=${ids.join(',')}` })
  },

  // 导出点检计划 Excel
  exportEquipmentCheckPlan: async (params) => {
    return await request.download({ url: `/business/equipment-check-plan/export-excel`, params })
  }
}